<?php
defined('SYS_RUN') or exit();

class Settings
{
    const DIR_CONF_APPLICATION = 'application/conf/';

    private static $settings = null;

    public static function get($name) {
        self::_import_application_config();
        
        if(isset(self::$settings[$name]))
            return self::$settings[$name];
        else Error::trigger('Not found setting:'. $name);
    }

    private static function _import_application_config()
    {
        if(!self::$settings) {
            $files = Lib::get('file')->getFilesList(DIR_SYS.self::DIR_CONF_APPLICATION);
            foreach($files as $file) {
                self::$settings = Sys::mergeArray(self::$settings, include_once DIR_SYS.self::DIR_CONF_APPLICATION.$file);
            }
        }
    }
} 